package com.example.project.projectspringcloud.utils;

import org.apache.commons.lang3.StringUtils;

import java.util.regex.Pattern;

public class PatterUtil {

    public static class Patterns {

        public static final String CHINA_MOBILE = "^1(3|4|5|7|8)\\d{9}$";
    }

    private static Pattern pattern = null;

    public static boolean match(String regex, String target) {
        if (StringUtils.isBlank(regex) || StringUtils.isBlank(target)) {
            return false;
        }
        pattern = Pattern.compile(regex);
        if (pattern.matcher(target).find()) {
            return true;
        }
        return false;
    }
}
